package com.project.mall.controller;

import com.project.mall.pojo.*;
import com.project.mall.service.ServiceL;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;
import java.util.List;

//后台页面跳转控制器
@Controller
@RequestMapping("after")
public class AfterController {
    @Resource
    private ServiceL serviceL;

    /*查询管理员信息*/
    @RequestMapping("admininfo")
    public String admininfo(Model model){
        List<Admin> admins = serviceL.allAdmin();
        model.addAttribute("alladmin",admins);
        return "after/admin-info";
    }
    @RequestMapping("membershow")
    public String membershow(){
        return "after/member-show";
    }
    @RequestMapping("adminadd")
    public String adminadd(){
        return "after/admin-add";
    }
    @RequestMapping("systemcategoryadd")
    public String systemcategoryadd(Secondtype secondtype){
       return "after/system-category-add";
    }
    @RequestMapping("changepassword")
    public String changepassword(){
        return "after/change-password";
    }
    @RequestMapping("productadd")
    public String productadd(){
        return "after/product-add";
    }
    @RequestMapping("index")
    public String index(){
        return "after/index";
    }
    @RequestMapping("login")
    public String login(){
        return "after/login";
    }
    @RequestMapping("welcome")
    public String welcome(){
        return "after/welcome";
    }
    @RequestMapping("systembase")
    public String systembase(){
        return "after/system-base";
    }
    /*查询所有User信息*/
    @RequestMapping("memberlist")
    public String memberlist(Model model){
        List<User> users = serviceL.allUser();
        model.addAttribute("all",users);
        Integer count = serviceL.allUserNo();
        model.addAttribute("count",count);
        return "after/member-list";
    }
    @RequestMapping("memberdel")
    public String memberdel(){
        return "after/member-del";
    }
    @RequestMapping("productupdate")
    public String productupdate(){ return "after/product-update"; }

    /*查询所有意见反馈表信息  Feedback*/
    @RequestMapping("feedbacklist")
    public String feedbacklist(Model model){
        List<Feedback> feedbacks = serviceL.allFeedback();
        model.addAttribute("allfeedback",feedbacks);
        Integer count = serviceL.allFeedbackNo();
        model.addAttribute("count",count);
        return "after/feedback-list";
    }
    /*查询所有评论功能信息*/
    @RequestMapping("commentlist")
    public String commentlist(Model model){
        List<Comment> comments = serviceL.allComment();
        model.addAttribute("allcomment",comments);
        Integer count = serviceL.allCommentss();
        model.addAttribute("count",count);
        return "after/comment-list";
    }
    /*查询产品管理Goods信息*/
    @RequestMapping("productlist")
    public String productlist(Model model){
        List<Goods> allGoods=serviceL.allGoods();
        model.addAttribute("allgoods",allGoods);
        Integer count = serviceL.allGoodss();
        model.addAttribute("count",count);
        return "after/product-list";
    }
    @RequestMapping("systemcategory")
    public String systemcategory(Model model){
        List<Secondtype> allsecondtype=serviceL.allSecondtype();
        model.addAttribute("allsecond",allsecondtype);
        Integer count = serviceL.allNo();
        model.addAttribute("count",count);
        return "after/system-category";
    }

    @RequestMapping("systemcategoryupdate")
    public String systemcategoryupdate(){
        return "after/system-category-update";
    }


}
